package com.itheima.object3;

public class Student {
    //成员变量私有化  private:权限修饰符,表示私有的
    private String name;
    private int age;

   /* //set,get方法,用public修饰,用于其他类访问和修改本类中的私有属性
    public void setName(String name){
        this.name = name;
    }

    public String getNamr(){
        return this.name;
    }

    public void setAge(int age){
        this.age = age;
    }

    public int getAge(){
        return this.age;
    }

    //构造方法,分为无参构造和有参构造,作用:用于创建对象,概念:创建对象时执行的方法,在对象的生命周期中只执行一次
    public Student(){
    }

    public Student(String name,int age){
        this.name = name;
        this.age = age;
    }*/

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Student() {
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
}
